package com.htthorizon.powersupply.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.htthorizon.powersupply.domain.TgUserSensitive;
import com.htthorizon.powersupply.service.TgUserSensitiveService;
import com.htthorizon.powersupply.mapper.TgUserSensitiveMapper;
import com.htthorizon.powersupply.utils.OrgUtil;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author Brilliant
 * @description 针对表【tg_user_sensitive】的数据库操作Service实现
 * @createDate 2025-01-18 18:48:33
 */
@Service
public class TgUserSensitiveServiceImpl extends ServiceImpl<TgUserSensitiveMapper, TgUserSensitive>
        implements TgUserSensitiveService{


    @Override
    public List<TgUserSensitive> listSensitiveAll() {
        return baseMapper.listSensitiveAll().stream().map(this::map).collect(Collectors.toList());
    }

    @Override
    public void deal() {
        baseMapper.deal();
    }

    private TgUserSensitive map(TgUserSensitive tgUserSensitive){
        String stdCountyOrgNm = tgUserSensitive.getStdCountyOrgNm();
        String map = OrgUtil.map(stdCountyOrgNm);
        tgUserSensitive.setStdCountyOrgNm(map);
        tgUserSensitive.setStdOrgNm(OrgUtil.getStdOrgNm(tgUserSensitive.getStdOrgNm()));
        return tgUserSensitive;
    }
}




